package com.example.redis;

import org.redisson.Redisson;
import org.redisson.config.Config;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;

/**
 * @author LiYuhang
 * @version 0.1
 * @application
 * @Copyright 上海申通快递总部
 * @company STO
 * @Date 2022/3/2 22:11
 */
@SpringBootApplication
public class RedisApp {
    public static void main(String[] args) {
        SpringApplication.run(RedisApp.class);
    }

    @Bean
    public Redisson redisson() {
        // 此为单机模式
        Config config = new Config();
        config.useSingleServer().setAddress("redis://47.101.134.226:6381").setDatabase(0);
        return (Redisson) Redisson.create(config);
    }
}
